/*
 * @Author: your name
 * @Date: 2021-06-07 13:51:37
 * @LastEditTime: 2021-06-18 16:51:29
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \bazai_ebook\src\router\index.js
 */
import { createRouter, createWebHashHistory } from 'vue-router'
const Ebook = () => import(/* webpackChunkName: "ebook" */ '../views/ebook/index.vue')
const Store = () => import(/* webpackChunkName: "store" */ '../views/store/index.vue')
const StoreHome = () => import(/* webpackChunkName: "storehome" */ '../views/store/StoreHome.vue')
const StoreList = () => import(/* webpackChunkName: "storelist" */ '../views/store/StoreList.vue')
const StoreDetail = () => import(/* webpackChunkName: "storedetail" */ '../views/store/StoreDetail.vue')
const StoreShelf = () => import(/* webpackChunkName: "storeshelf" */ '../views/store/StoreShelf.vue')
const routes = [
  {
    path: '/',
    redirect: '/ebook'
  },
  {
    path: '/ebook',
    name: 'ebook',
    component: Ebook,
    children: [
      {
        path: ':fileName', // 动态路由
        component: () => import(/* webpackChunkName: "ebookReader" */ '_c/ebook/EbookReader.vue')
      }
    ]
  },
  {
    path: '/store',
    name: 'store',
    redirect: '/store/shelf',
    component: Store,
    children: [
      {
        path: 'shelf',
        name: 'StoreShelf',
        component: StoreShelf
      },
      {
        path: 'home',
        name: 'StoreHome',
        component: StoreHome
      },
      {
        path: 'list',
        name: 'StoreList',
        component: StoreList
      },
      {
        path: 'detail',
        name: 'StoreDetail',
        component: StoreDetail
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
